<?php 
class X_debug{
    public static $mysql_errors = array();
    public static function mysqlErrors(){
        echo "<pre>";
        foreach (X_debug::$mysql_errors as $error) {
            echo $error."\n";
        }
        echo "</pre>";
    }
    public static function paths(){
        echo '<strong>LIBS_PATH</strong> : <tt>'.LIBS_PATH.'</tt><br />
              <strong>APPLICATION_PATH</strong> : <tt>'.APPLICATION_PATH.'</tt><br />
              <strong>DOCUMENT_ROOT</strong> : <tt>'.DOCUMENT_ROOT.'</tt><br />
              <strong>HTTP_ROOT</strong> : <tt>'.HTTP_ROOT.'</tt>
              ';
    }
    public static function scriptTime($units=null){
        if(defined('START')){
            $endTime= microtime(true);
            switch($units){
                default : case 'sec' : 
                    $mult= 1;
                    break;
                case 'ms' : 
                    $mult= 1000;
                    break;
                case 'us' : 
                    $mult= 1000000;
                    break;
                case 'ns' : 
                    $mult= 1000000000;
                    break;
            }
            $retVal= (double)(((double)$endTime-(double)START)*(double)$mult);
            if($units!=null)$retVal .= " ".$units;
            return $retVal;
        }
    }
}
